package com.heima.wemedia.utils;

import com.heima.model.wemedia.entity.WmUser;

public class WmThreadLocalUtil {
    private static final ThreadLocal<WmUser> TL=new ThreadLocal<>();

    /**
     * 保存用户信息到Thread Local
     * @param wmUser
     */
    public static void set(WmUser wmUser){
        if (wmUser!=null){
            TL.set(wmUser);
        }
    }

    /**
     * 从Thread Local获取用户信息
     * @return
     */
    public static WmUser get(){
        return TL.get();
    }

    public static void remove(){
        TL.remove();
    }
}
